invokevirtual
invokenonvirtual
super
or the name of a superclass is used as a method qualifier.
invokestatic
static
) method in a named class.
invokeinterface
invokevirtual = 182 |
indexbyte1 |
indexbyte2 |
Stack: ..., objectref, [arg1, [arg2 ...]], ... => ...The operand stack must contain a reference to an object and some number of arguments. indexbyte1 and indexbyte2 are used to construct an index into the constant pool of the current class. The item at that index in the constant pool contains the complete method signature. A pointer to the object's method table is retrieved from the object reference. The method signature is looked up in the method table. The method signature is guaranteed to exactly match one of the method signatures in the table.
The result of the lookup is an index into the method table of the named class, which is used with the object's dynamic type to look in the method table of that type, where a pointer to the method block for the matched method is found. The method block indicates the type of method (native
, synchronized
, and so on) and the number of arguments expected on the operand stack.
If the method is marked synchronized
the monitor associated with objectref is entered.
The objectref and arguments are popped off this method's stack and become the initial values of the local variables of the new method. Execution continues with the first instruction of the new method.
If the object reference on the operand stack is null
, a NullPointerException
is thrown. If during the method invocation a stack overflow is detected, a StackOverflowError
is thrown.
invokenonvirtual = 183 |
indexbyte1 |
indexbyte2 |
Stack: ..., objectref, [arg1, [arg2 ...]], ... => ...The operand stack must contain a reference to an object and some number of arguments. indexbyte1 and indexbyte2 are used to construct an index into the constant pool of the current class. The item at that index in the constant pool contains a complete method signature and class. The method signature is looked up in the method table of the class indicated. The method signature is guaranteed to exactly match one of the method signatures in the table.
The result of the lookup is a method block. The method block indicates the type of method (native
, synchronized
, and so on) and the number of arguments (nargs) expected on the operand stack.
If the method is marked synchronized
the monitor associated with objectref is entered.
The objectref and arguments are popped off this method's stack and become the initial values of the local variables of the new method. Execution continues with the first instruction of the new method.
If the object reference on the operand stack is null
, a NullPointerException
is thrown. If during the method invocation a stack overflow is detected, a StackOverflowError
is thrown.
invokestatic = 184 |
indexbyte1 |
indexbyte2 |
Stack: ..., [arg1, [arg2 ...]], ... => ...The operand stack must contain some number of arguments. indexbyte1 and indexbyte2 are used to construct an index into the constant pool of the current class. The item at that index in the constant pool contains the complete method signature and class. The method signature is looked up in the method table of the class indicated. The method signature is guaranteed to exactly match one of the method signatures in the class's method table.
The result of the lookup is a method block. The method block indicates the type of method (native
, synchronized
, and so on) and the number of arguments (nargs) expected on the operand stack.
If the method is marked synchronized
the monitor associated with the class is entered.
The arguments are popped off this method's stack and become the initial values of the local variables of the new method. Execution continues with the first instruction of the new method.
If during the method invocation a stack overflow is detected, a StackOverflowError
is thrown.
invokeinterface = 185 |
indexbyte1 |
indexbyte2 |
nargs |
reserved |
Stack: ..., objectref, [arg1, [arg2 ...]], ... => ...The operand stack must contain a reference to an object and nargs-1 arguments. indexbyte1 and indexbyte2 are used to construct an index into the constant pool of the current class. The item at that index in the constant pool contains the complete method signature. A pointer to the object's method table is retrieved from the object reference. The method signature is looked up in the method table. The method signature is guaranteed to exactly match one of the method signatures in the table.
The result of the lookup is a method block. The method block indicates the type of method (native
, synchronized
, and so on) but unlike invokevirtual
and invokenonvirtual
, the number of available arguments (nargs) is taken from the bytecode.
If the method is marked synchronized
the monitor associated with objectref is entered.
The objectref and arguments are popped off this method's stack and become the initial values of the local variables of the new method. Execution continues with the first instruction of the new method.
If the objectref on the operand stack is null
, a NullPointerException
is thrown. If during the method invocation a stack overflow is detected, a StackOverflowError
is thrown.